package com.myapp.api.service.impl;

import com.myapp.api.entity.StudentCourse;
import com.myapp.api.entity.StudentCourseKey;
import com.myapp.api.mapper.StudentCourseMapper;
import com.myapp.api.service.StudentCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentCourseServiceImpl implements StudentCourseService {
    @Autowired
    private StudentCourseMapper mapper;

    @Override
    public List<StudentCourse> getStudentCourses() {
        return mapper.getStudentCourses();
    }

    @Override
    public int addStudentCourse(@Param("record") StudentCourse record) {
        return mapper.insertSelective(record);
    }

    @Override
    public int deleteStudentCourseById(@Param("key") StudentCourseKey key) {
        return mapper.deleteByPrimaryKey(key);
    }

    @Override
    public int putStudentCourse(@Param("record") StudentCourse record) {
        return mapper.updateByPrimaryKeySelective(record);
    }
}
